﻿using System.Collections.Generic;
using System.Threading.Tasks;
using VK.Client;

namespace VK.Actions
{
    public class Wall
    {
        private readonly VkApiRequest _request;

        public Wall(VkApiRequest request)
        {
            _request = request;
        }

        public record WallInfo(int Id, int FromId, int OwnerId, int Date, int MarkedAsAds, string PostType,
            string Text, int CanPin, IEnumerable<object> Attachments, object Comments, object Likes, object Reposts,
            object Views);

        public record WallPaginator(int Count, IEnumerable<WallInfo> Items);

        /// <summary>
        /// 
        /// </summary>
        /// <see href="https://vk.com/dev/wall.get"/>
        /// <param name="accessToken"></param>
        /// <param name="params"></param>
        /// <returns></returns>
        public Task<VkResponse<WallPaginator>> Get(string accessToken, Dictionary<string, object> @params = null)
        {
            return _request.post<WallPaginator>("wall.get", accessToken, @params);
        }
        
        public Task<VkResponse<WallInfo>> GetById(string accessToken, Dictionary<string, object> @params = null)
        {
            return _request.post<WallInfo>("wall.getById", accessToken, @params);
        }
        
        public Task<VkResponse<WallInfo>> Post(string accessToken, Dictionary<string, object> @params = null)
        {
            return _request.post<WallInfo>("wall.post", accessToken, @params);
        }
    }
}